<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <head>
        <title>Polyglott Demo</title>
        <link rel="stylesheet" type="text/css" href="css/site.css" />
    </head>
    <body>

        <h1>Unit Converter</h1>

        <h2>Time</h2>
        <h:form>
            <h:panelGrid columns="2" class="converterGrid">

                <f:facet name="header">From &harr; To</f:facet>

                <h:panelGrid>
                    <h:outputLabel value="Value" />
                    <h:inputText  value="#{timeConverter.fromValue}" />

                    <h:outputLabel value="Unit" />
                    <h:selectOneMenu value="#{timeConverter.fromUnit}">
                        <f:selectItems value="#{timeConverter.availableUnits}" /> 
                    </h:selectOneMenu>
                </h:panelGrid>

                <h:panelGrid>
                    <h:outputLabel value="Value" />
                    <h:inputText  value="#{timeConverter.formattedToValue}" readonly="true" />


                    <h:outputLabel value="Unit" />
                    <h:selectOneMenu value="#{timeConverter.toUnit}">
                        <f:selectItems value="#{timeConverter.availableUnits}" /> 
                    </h:selectOneMenu>
                </h:panelGrid>

                <f:facet name="footer">
                    <h:commandButton value="calculate" 
                                     action="#{timeConverter.valueChanged()}" 
                                     type="submit" />
                </f:facet>
            </h:panelGrid>
        </h:form>
    </body>
</html>

